const db = wx.cloud.database()
Page({
  data: {
    rooms: [],
  },

  onLoad: function (options) {
    db.collection('room').get().then(res => {
      this.setData({rooms:res.data})
    })
  },

  meetingRules: function (event) {
    wx.showLoading({
      title: '文档打开中...',
    })
    wx.cloud.downloadFile({
      fileID: 'cloud://test-0pmu0.7465-test-0pmu0-1300559272/room/计算机与人工智能学院会议室使用规则.docx'
    }).then(res => {
      console.log(res.tempFilePath)
      const filePath = res.tempFilePath
      wx.openDocument({
        filePath: filePath,
        success: res => {
          console.log('打开文档成功')
          wx.hideLoading()
        }
      })
    }).catch(error => {
      // handle error
    })
  },

  myOrder:function(event)
  {
    var phone = wx.getStorageSync('phone');
    if (phone != "") {
      wx.navigateTo({
        url: '../myorder/myorder'
      })
    }
    else{
      wx.navigateTo({
        url: '../login/login'
      })
    }
  }
})